<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>逗号运算符</title>
</head>

<body>
  <script>
    // 逗号运算符, 从左向右依次执行,返回最后一个表达式的值
    // var a = (1, 2, 3, 234, 345, 100)
    // console.log(a); // 100

    // var a = 1;
    // var b = 2;
    // var c = (a++, ++b, ++a, b++, a + b)
    // console.log(c); // 7

    for (var i = 1, j = 2; i < 3, j < 4; i++, j++) {
      console.log(i, j)
      // 1 2
      // 2 3
    }


  </script>
</body>

</html>